home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 2
/
SPACE - Library 2 - Volume 1.iso
/
telecom
/
260
/
keytable.s
< prev
next >
Wrap
Text File
|
1988-07-08
|
7KB
|
187 lines
; Message inbox:15 - Read
; From: <WACKER@CERNVM.cern>
; To: "Mike Gerard CERN-DD (JMG AT CERNVAX)" <jmg@priam.cern>
; In-Reply-To: Your message of 12 Feb 88 15:56 +0100
;
; >X-Bitnet-Sender: Klaus Wacker <WACKER@CERNVM>
;
;
;
; change keyboard tables Klaus Wacker
;
; This program first checks, whether the keyboard tables are already
; in RAM (address < 4 Mega).
;
; If they are not in ram, the tables contained in here are kept
; and installed using keytbl (xbios 16). Furthermore, code to
; intercept future bioskeys (xbios 24) calls is installed. Bioskeys
; is replaced by keytbl.
;
; If they are already in RAM, they are overwritten, but only the
; positions corresponding to "typewriter" keys, not the keypad and
; function keys. Thus, this program, or different versions of it,
; can be called several times in a session without eating up more
; and more space.
;
gemdos: equ 1
keep_process: equ $31
;
bios: equ 13
xbios: equ 14
keytbl: equ 16
bioskeys: equ 24
supexec: equ 38
;
xbiosvec: equ xbios+$20
;
section text
start: bra skip
;
;
unshift:
NORMALTBL:
dc.b $00,$1B,$31,$32,$33,$34,$35,$36 ; ..123456
dc.b $37,$38,$39,$30,$2D,$27,$08,$09 ; 7890-'..
dc.b $71,$77,$65,$72,$74,$79,$75,$69 ; qwertyui
dc.b $6F,$70,$40,$2B,$0D,$00,$61,$73 ; op@+..as
dc.b $64,$66,$67,$68,$6A,$6B,$6C,$5B ; dfghjkl(square bracket)
dc.b $5D,$23,$00,$7E,$7A,$78,$63,$76 ; ]#.^zxcv
dc.b $62,$6E,$6D,$2C,$2E,$2F,$00,$00 ; bnm,./..
dc.b $00,$20,$00,$00,$00,$00,$00,$00 ; . ......
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
dc.b $00,$00,$2D,$00,$00,$00,$2B,$00 ; ..-...+.
dc.b $00,$00,$00,$7F,$00,$00,$00,$00 ; ... ....
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
dc.b $3C,$00,$00,$28,$29,$2F,$2A,$37 ; <..()/*7
dc.b $38,$39,$34,$35,$36,$31,$32,$33 ; 89456123
dc.b $30,$2E,$0D,$00,$00,$00,$00,$00 ; 0.......
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
shift:
SHIFTTBL:
dc.b $00,$1B,$21,$22,$DD,$24,$25,$26 ; ..!"]$%&
dc.b $2D,$28,$29,$3D,$3F,$60,$08,$09 ; -()=?`..
dc.b $51,$57,$45,$52,$54,$59,$55,$49 ; QWERTYUI
dc.b $4F,$50,$5C,$2A,$0D,$00,$41,$53 ; OP\*..AS
dc.b $44,$46,$47,$48,$4A,$4B,$4C,$7B ; DFGHJKL{
dc.b $7D,$5E,$00,$7C,$5A,$58,$43,$56 ; }|.|ZXCV
dc.b $42,$4E,$4D,$3B,$3A,$5F,$00,$00 ; BNM;:_..
dc.b $00,$20,$00,$00,$00,$00,$00,$00 ; . ......
dc.b $00,$00,$00,$00,$00,$00,$00,$37 ; .......7
dc.b $38,$00,$2D,$34,$00,$36,$2B,$00 ; 8.-4.6+.
dc.b $32,$00,$30,$7F,$00,$00,$00,$00 ; 2.0 ....
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
dc.b $3E,$00,$00,$28,$29,$2F,$2A,$37 ; >..()/*7
dc.b $38,$39,$34,$35,$36,$31,$32,$33 ; 89456123
dc.b $30,$2E,$0D,$00,$00,$00,$00,$00 ; 0.......
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
capsloc:
CAPSLOCKTBL:
dc.b $00,$1B,$31,$32,$33,$34,$35,$36 ; ..123456
dc.b $37,$38,$39,$30,$2D,$27,$08,$09 ; 7890-'..
dc.b $51,$57,$45,$52,$54,$59,$55,$49 ; QWERTYUI
dc.b $4F,$50,$40,$2B,$0D,$00,$41,$53 ; OP@+..AS
dc.b $44,$46,$47,$48,$4A,$4B,$4C,$5B ; DFGHJKL(square bracket)
dc.b $5D,$23,$00,$7E,$5A,$58,$43,$56 ; ]#.^ZXCV
dc.b $42,$4E,$4D,$2C,$2E,$2F,$00,$00 ; BNM,./..
dc.b $00,$20,$00,$00,$00,$00,$00,$00 ; . ......
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
dc.b $00,$00,$2D,$00,$00,$00,$2B,$00 ; ..-...+.
dc.b $00,$00,$00,$7F,$00,$00,$00,$00 ; ... ....
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
dc.b $3C,$00,$00,$28,$29,$2F,$2A,$37 ; <..()/*7
dc.b $38,$39,$34,$35,$36,$31,$32,$33 ; 89456123
dc.b $30,$2E,$0D,$00,$00,$00,$00,$00 ; 0.......
dc.b $00,$00,$00,$00,$00,$00,$00,$00 ; ........
;
; disable xbios(24)(bioskeys), replace it by xbios(16)(these keys).
new_xbios:
btst #5,(sp) ;called from supervisor status?
bne.s supcall ;yes
move usp,a0; get user stack pointer
bra.s nosup
supcall: movea.l sp,a0 ;get supervisor stack pointer
addq.l #6,a0 ;correct for pc and sr saved by trap
nosup: cmp.w #bioskeys,(a0) ; check function if bioskeys
beq.s hackbioskeys
jmp: jmp $1234567 ;replaced by old xbios address by init
oldxbios: equ jmp+2
;
hackbioskeys:
pea capsloc(pc) ;do keytbl instead
pea shift(pc)
pea unshift(pc)
move.w #keytbl,-(sp)
trap #xbios ;call xbios recursively- hope this will work
add.l #14,sp
rte ;back from trap
;
;*************************** end of resident part ***********************
;
skip:
; get address of old table
moveq #-1,d7
move.l d7,-(sp)
move.l d7,-(sp)
move.l d7,-(sp)
move.w #keytbl,-(sp)
trap #xbios
add.l #14,sp
; are the tables already in RAM?
move.l d0,a4 ; get pointer to list of addresses
moveq #3-1,d4 ; set loop for 3 128byte tables
;
next_address:
move.l (a4)+,a3 ; get next table adress
cmp.l #$100000,a3 ;up to 4MB RAM
bgt.s set_pointers
dbra d4,next_address
;
; yes, overwrite them (but only the typewriter keys: $01 - $3A, $60)
move.l d0,a4 ; get pointer to list of addresses
moveq #3-1,d4 ; set loop for 3 tables
lea unshift(pc),a1 ; set target adress
;
next_table:
move.l a1,a2
move.l (a4)+,a3 ; get next table adress
move.b $60(a2),$60(a3) ; first copy the extra key at $60
addq.l #1,a3 ; start at $01
addq.l #1,a2
move.w #$3a-2,d5 ; copy up to $3a
;
copy: move.b (a2)+,(a3)+
dbra d5,copy
adda.l #$80,a1 ; begin of next table
dbra d4,next_table
;
move.w #0,-(sp) ;normal termination
trap #gemdos
;
; table wasn't in RAM
; now make these tables official
set_pointers:
pea capsloc(pc)
pea shift(pc)
pea unshift(pc)
move.w #keytbl,-(sp)
trap #xbios
add.l #14,sp
;and cast them in concrete
pea exchvec(pc) ;exchange trap 14 vector
move.w #supexec,-(sp) ;set exception vector
trap #xbios
addq.l #6,sp
;
clr.w -(sp)
move.l #skip-start+$100,-(sp) ;keep the table and the xbios
;hack only ($100 for the base page)
move.w #keep_process,-(sp)
trap #gemdos ;stop
exchvec: move.l 4*xbiosvec,oldxbios ;old xbios as jump address
lea new_xbios(pc),a0 ;get new xbios address
move.l a0,4*xbiosvec ;and store it in the vector
rts
;
end